package com.web_bloks.widget.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.AbstractImagePrototype;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.SimplePanel;

/**
 * 
 * @author Jean-Lou Dupont
 *
 */
public class ConfigWidget extends Composite {

	ImgAnchor img = null;
	SimplePanel panel = null;
	
	public ConfigWidget() {
		super();
		setup("/#Config");
	}
	
	public ConfigWidget(String href) {
		super();
		setup( href );
	}
	
	protected void setup(String href) {
		final WidgetMessages MSG = (WidgetMessages) GWT.create(WidgetMessages.class);
		
		WidgetImageBundle bundle = (WidgetImageBundle) GWT.create( WidgetImageBundle.class );
		
		AbstractImagePrototype p = bundle.config();
		
		this.img = GWT.create(ImgAnchor.class);
		
		this.img.setTitle(MSG.configure());

		this.img.setImg( p.createImage() );
		
		this.img.setHref( href );
		
		panel = GWT.create(SimplePanel.class);
		panel.add( this.img );
		
		initWidget( panel );
	}
	
	public void setHref(String href) {
		img.setHref(href);
	}
}//END